package com.binguo.api.huawei.imagesearch.util;


import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import javax.imageio.ImageIO;
public class AnnotationFileUtil {

    public static void main(String[] args) throws IOException {
        BufferedImage image = ImageIO.read(new File("/Users/jay/IdeaProjects/binguo/api/target/1562728412201.jpg"));
        long s = System.currentTimeMillis();
        System.out.println(s);
        Graphics g = image.getGraphics();
        g.setColor(Color.BLUE);//画笔颜色
        Graphics2D graphics2D = (Graphics2D)g;

        graphics2D.setStroke(new BasicStroke(5.0f));

        int width = 376 - 69;
        int height = 568 - 272;
        graphics2D.setFont(new Font(null, Font.PLAIN, 25));
        graphics2D.drawRect(272, 69, width, height);//矩形框(原点x坐标，原点y坐标，矩形的长，矩形的宽)
        graphics2D.drawString("hello", 272, 69);
        graphics2D.dispose();
        long e = System.currentTimeMillis();
        System.out.println(e);
        System.out.println(e- s);
        FileOutputStream out = new FileOutputStream("/Users/jay/IdeaProjects/binguo/api/target/test2.jpg");//输出图片的地址
        ImageIO.write(image, "jpeg", out);


    }


    public void generateFile(){

    }
}
